<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 600px;
            height: 200px;
            border: 1px solid;
        }

        span {
            font-size: 20px;
            font-weight: 700;
        }

        .text {
            width: 100%;
            height: 100px;
            font-size: 14px;
            font-weight: 400;
            /* background-color: aquamarine; */
        }
    </style>
</head>

<body>
    <div class="box">
        <span>开心一笑..<span>
                <button id="btn">换一个</button>
                <div class="text"></div>
    </div>
</body>

</html>
<script src="./lib/jquery-1.12.4.js"></script>
<script src="./lib/template-web.js"></script>

<script>
    //入口函数
    $(function () {
        $('.text').text('加载中...')
        $.ajax({
            url: 'https://autumnfish.cn/api/joke',
            success: function (backData) {
                $('.text').text(backData)
            }
        })
        //给按钮设置设置点击事件
        $('#btn').on('click', function () {
            $('.text').text('加载中...')
            $.ajax({
                url: 'https://autumnfish.cn/api/joke',
                success: function (backData) {
                    $('.text').text(backData)
                }
            })

        })
    })

</script>